<!DOCTYPE html><html lang="en" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0,viewport-fit=cover"><title>JavaScript的原型和原型链 | Closure233</title><meta name="author" content="Closure233"><meta name="copyright" content="Closure233"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="JavaScript的原型和原型链原型JavaScript没有类的概念，所以使用了构造函数来实现继承机制： 1234567&#x2F;&#x2F; 构造函数和实例化function Person(name, age, sex)&amp;#123;    this.name &#x3D; name;    this.age &#x3D; age;    this.sex &#x3D; sex;&amp;#125;const person &#x3D; new Person(">
<meta property="og:type" content="article">
<meta property="og:title" content="JavaScript的原型和原型链">
<meta property="og:url" content="https://closure.gitee.io/2023/05/20/JavaScript%E7%9A%84%E5%8E%9F%E5%9E%8B%E5%92%8C%E5%8E%9F%E5%9E%8B%E9%93%BE/index.html">
<meta property="og:site_name" content="Closure233">
<meta property="og:description" content="JavaScript的原型和原型链原型JavaScript没有类的概念，所以使用了构造函数来实现继承机制： 1234567&#x2F;&#x2F; 构造函数和实例化function Person(name, age, sex)&amp;#123;    this.name &#x3D; name;    this.age &#x3D; age;    this.sex &#x3D; sex;&amp;#125;const person &#x3D; new Person(">
<meta property="og:locale" content="en_US">
<meta property="og:image" content="https://closure.gitee.io/images/avatar.gif">
<meta property="article:published_time" content="2023-05-20T03:30:00.000Z">
<meta property="article:modified_time" content="2023-08-08T05:17:08.040Z">
<meta property="article:author" content="Closure233">
<meta property="article:tag" content="js">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://closure.gitee.io/images/avatar.gif"><link rel="shortcut icon" href="/images/moss.ico"><link rel="canonical" href="https://closure.gitee.io/2023/05/20/JavaScript%E7%9A%84%E5%8E%9F%E5%9E%8B%E5%92%8C%E5%8E%9F%E5%9E%8B%E9%93%BE/index.html"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox/fancybox.min.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = {
  root: '/',
  algolia: undefined,
  localSearch: undefined,
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: 'Copy successfully',
    error: 'Copy error',
    noSupport: 'The browser does not support'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '',
  dateSuffix: {
    just: 'Just',
    min: 'minutes ago',
    hour: 'hours ago',
    day: 'days ago',
    month: 'months ago'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  source: {
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isAnchor: true,
  percent: {
    toc: true,
    rightside: false,
  },
  autoDarkmode: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: 'JavaScript的原型和原型链',
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2023-08-08 13:17:08'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
    win.getCSS = (url,id = false) => new Promise((resolve, reject) => {
      const link = document.createElement('link')
      link.rel = 'stylesheet'
      link.href = url
      if (id) link.id = id
      link.onerror = reject
      link.onload = link.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        link.onload = link.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(link)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const detectApple = () => {
      if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    })(window)</script><meta name="generator" content="Hexo 5.4.2"></head><body><div id="web_bg"></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="/images/avatar.gif" onerror="onerror=null;src='/images/friend_404.gif'" alt="avatar"/></div><div class="sidebar-site-data site-data is-center"><a href="/archives/"><div class="headline">Articles</div><div class="length-num">11</div></a><a href="/tags/"><div class="headline">Tags</div><div class="length-num">6</div></a><a href="/categories/"><div class="headline">Categories</div><div class="length-num">0</div></a></div><hr/></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background: url(/images/cover/cover1.jpg)"><nav id="nav"><span id="blog-info"><a href="/" title="Closure233"><span class="site-name">Closure233</span></a></span><div id="menus"><div id="toggle-menu"><a class="site-page" href="javascript:void(0);"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">JavaScript的原型和原型链</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">Created</span><time class="post-meta-date-created" datetime="2023-05-20T03:30:00.000Z" title="Created 2023-05-20 11:30:00">2023-05-20</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">Updated</span><time class="post-meta-date-updated" datetime="2023-08-08T05:17:08.040Z" title="Updated 2023-08-08 13:17:08">2023-08-08</time></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="JavaScript的原型和原型链"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">Post View:</span><span id="busuanzi_value_page_pv"><i class="fa-solid fa-spinner fa-spin"></i></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h1 id="JavaScript的原型和原型链"><a href="#JavaScript的原型和原型链" class="headerlink" title="JavaScript的原型和原型链"></a>JavaScript的原型和原型链</h1><h2 id="原型"><a href="#原型" class="headerlink" title="原型"></a>原型</h2><p>JavaScript没有类的概念，所以使用了<strong>构造函数</strong>来实现继承机制：</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// 构造函数和实例化</span></span><br><span class="line"><span class="keyword">function</span> <span class="title function_">Person</span>(<span class="params">name, age, sex</span>)&#123;</span><br><span class="line">    <span class="variable language_">this</span>.<span class="property">name</span> = name;</span><br><span class="line">    <span class="variable language_">this</span>.<span class="property">age</span> = age;</span><br><span class="line">    <span class="variable language_">this</span>.<span class="property">sex</span> = sex;</span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">const</span> person = <span class="keyword">new</span> <span class="title class_">Person</span>(<span class="string">&#x27;Ada&#x27;</span>, <span class="number">18</span>, <span class="string">&#x27;female&#x27;</span>);</span><br></pre></td></tr></table></figure>

<p>如上代码所示，JavaScript通过<mark>构造函数</mark>生成实例，但是在构造函数中通过<mark>this</mark>赋值的属性或方法是每个实例的<strong>实例属性</strong>和<strong>实例方法</strong>，无法实现公共属性的共享。为了解决共享公共属性的问题，js增加了一个<code>原型对象（prototype）</code>来存储构造函数的公共属性和方法。</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// 在原型对象上增加一个公共方法</span></span><br><span class="line"><span class="title class_">Person</span>.<span class="property"><span class="keyword">prototype</span></span>.<span class="property">getAge</span> = <span class="keyword">function</span>(<span class="params"></span>)&#123;</span><br><span class="line">    <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="string">`<span class="subst">$&#123;<span class="variable language_">this</span>.age&#125;</span>&#x27;s age is <span class="subst">$&#123;<span class="variable language_">this</span>.age&#125;</span>`</span>);</span><br><span class="line">&#125;</span><br><span class="line"><span class="comment">// 调用公共方法</span></span><br><span class="line">person.<span class="title function_">getAge</span>();<span class="comment">// Ada&#x27;s age is 18</span></span><br></pre></td></tr></table></figure>

<p>JavaScript的函数在创建时会生成一个属性<code>prototype</code>，该属性指向此函数的原型对象，原型对象中有一个<code>constructor</code>属性指向该函数（构造函数），这样就形成了<code>原型对象</code>和<code>构造函数</code>之间的联系。</p>
<p><img src="C:\Users\Rong\AppData\Roaming\marktext\images\2023-05-21-17-31-43-image.png"></p>
<h2 id="原型链"><a href="#原型链" class="headerlink" title="原型链"></a>原型链</h2><p>以上代码中的构造函数创建的实例对象可以调用构造函数的原型对象上的方法，但是原型对象的方法并没有定义在实例对象本身上，这是因为实例对象通过<mark>原型链</mark>调用了原型对象上的方法，</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">person.<span class="title function_">hasOwnProperty</span>(<span class="string">&#x27;getAge&#x27;</span>);<span class="comment">// false 说明getAge方法没有定义在实例对象上</span></span><br></pre></td></tr></table></figure>

<p>每个通过构造函数创建的实例对象都有一个<code>__proto__</code>属性，指向该实例对象的构建函数的<mark>原型对象</mark>。</p>
<p><img src="C:\Users\Rong\AppData\Roaming\marktext\images\2023-05-21-17-50-18-image.png"></p>
<blockquote>
<p><code>__proto__</code> 并不是语言本身的特性，这是各大厂商具体实现时添加的<code>私有属性</code>，虽然目前很多现代浏览器的 JS 引擎中都提供了这个私有属性，但依旧不建议在生产中使用该属性，避免对环境产生依赖。生产环境中，我们可以使用 Object.getPrototypeOf 方法来获取实例对象的原型，然后再来为原型添加方法/属性。（摘自阮一峰的ES6入门）</p>
</blockquote>
<p>当访问实例对象的一个属性或方法时，会先在该对象本身的属性和方法查找。如果没有查找到，会通过<code>__proto__</code>隐式属性找到该对象的<mark>构造函数</mark>的<mark>原型对象</mark>。如果原型对象上也没有，则会再通过构造函数的<code>prototype</code>的<code>__proto__</code>向上查找，这样不断向上的链式结构就是<code>原型链</code>。</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// 构造函数</span></span><br><span class="line"><span class="keyword">function</span> <span class="title function_">Person</span>(<span class="params">name, age, sex</span>)&#123;</span><br><span class="line">    <span class="variable language_">this</span>.<span class="property">name</span> = name;</span><br><span class="line">    <span class="variable language_">this</span>.<span class="property">age</span> = age;</span><br><span class="line">    <span class="variable language_">this</span>.<span class="property">sex</span> = sex;</span><br><span class="line">&#125;</span><br><span class="line"><span class="comment">// 在原型对象上增加一个公共方法</span></span><br><span class="line"><span class="title class_">Person</span>.<span class="property"><span class="keyword">prototype</span></span>.<span class="property">getAge</span> = <span class="keyword">function</span>(<span class="params"></span>)&#123;</span><br><span class="line">    <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="string">`<span class="subst">$&#123;<span class="variable language_">this</span>.name&#125;</span>&#x27;s age is <span class="subst">$&#123;<span class="variable language_">this</span>.age&#125;</span>`</span>);</span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">const</span> person1 = <span class="keyword">new</span> <span class="title class_">Person</span>(<span class="string">&#x27;Ada&#x27;</span>, <span class="number">18</span>, <span class="string">&#x27;female&#x27;</span>);</span><br><span class="line"><span class="keyword">const</span> person2 = <span class="keyword">new</span> <span class="title class_">Person</span>(<span class="string">&#x27;Levi&#x27;</span>, <span class="number">24</span>, <span class="string">&#x27;male&#x27;</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">// 调用共享的公共方法</span></span><br><span class="line">person1.<span class="title function_">getAge</span>();<span class="comment">// Ada&#x27;s age is 18</span></span><br><span class="line">person1.<span class="title function_">hasOwnProperty</span>(<span class="string">&#x27;getAge&#x27;</span>);<span class="comment">// false</span></span><br><span class="line"></span><br><span class="line"><span class="comment">// 通过实例对象的__proto__属性，往原型对象中添加方法</span></span><br><span class="line">person1.<span class="property">__proto__</span>.<span class="property">getSex</span> = <span class="keyword">function</span> (<span class="params"></span>) &#123;</span><br><span class="line">     <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="string">`<span class="subst">$&#123;<span class="variable language_">this</span>.name&#125;</span>&#x27;s sex is <span class="subst">$&#123;<span class="variable language_">this</span>.sex&#125;</span>`</span>);</span><br><span class="line">&#125;</span><br><span class="line">pperson2.<span class="title function_">getSex</span>(); <span class="comment">//Levi&#x27;s sex is male 调用了往原型对象中添加方法</span></span><br></pre></td></tr></table></figure>

<blockquote>
<p>注意：不要在实际开发的时候，通过<code>实例对象</code>改变其构造函数的<code>原型对象</code>，这样会对其他通过该构造函数的创建的实例对象产生影响</p>
</blockquote>
<h2 id="其他"><a href="#其他" class="headerlink" title="其他"></a>其他</h2><p>原型链的尽头是<code>null</code>。</p>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">Author: </span><span class="post-copyright-info"><a target="_blank" rel="noopener" href="https://gitee.com/closure233">Closure233</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">Link: </span><span class="post-copyright-info"><a href="https://closure.gitee.io/2023/05/20/JavaScript%E7%9A%84%E5%8E%9F%E5%9E%8B%E5%92%8C%E5%8E%9F%E5%9E%8B%E9%93%BE/">https://closure.gitee.io/2023/05/20/JavaScript%E7%9A%84%E5%8E%9F%E5%9E%8B%E5%92%8C%E5%8E%9F%E5%9E%8B%E9%93%BE/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">Copyright Notice: </span><span class="post-copyright-info">All articles in this blog are licensed under <a target="_blank" rel="noopener" href="https://creativecommons.org/licenses/by-nc-sa/4.0/">CC BY-NC-SA 4.0</a> unless stating additionally.</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/tags/js/">js</a></div><div class="post_share"><div class="social-share" data-image="/images/avatar.gif" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/js/social-share.min.js" defer></script></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/2023/05/20/%E8%8A%82%E6%B5%81%E5%87%BD%E6%95%B0%E5%92%8C%E9%98%B2%E6%8A%96%E5%87%BD%E6%95%B0/" title="节流函数和防抖函数"><div class="cover" style="background: url(/images/cover/cover1.jpg)"></div><div class="pagination-info"><div class="label">Previous Post</div><div class="prev_info">节流函数和防抖函数</div></div></a></div><div class="next-post pull-right"><a href="/2023/05/20/Promise%E6%98%AF%E4%BB%80%E4%B9%88%E5%8F%8A%E5%85%B6%E6%96%B9%E6%B3%95%E7%89%B9%E6%80%A7/" title="Promise是什么及其方法特性"><div class="cover" style="background: url(/images/cover/cover1.jpg)"></div><div class="pagination-info"><div class="label">Next Post</div><div class="next_info">Promise是什么及其方法特性</div></div></a></div></nav><div class="relatedPosts"><div class="headline"><i class="fas fa-thumbs-up fa-fw"></i><span>Related Articles</span></div><div class="relatedPosts-list"><div><a href="/2023/05/10/JavaScript%E7%9A%84%E5%86%92%E6%B3%A1%E5%92%8C%E6%8D%95%E8%8E%B7/" title="JavaScript的冒泡和捕获"><div class="cover" style="background: url(/images/cover/cover1.jpg)"></div><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2023-05-10</div><div class="title">JavaScript的冒泡和捕获</div></div></a></div><div><a href="/2023/05/08/JavaScript%E7%9A%84%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B%E5%92%8C%E9%9A%90%E5%BC%8F%E8%BD%AC%E6%8D%A2/" title="JavaScript的数据类型和隐式转换"><div class="cover" style="background: url(/images/cover/cover1.jpg)"></div><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2023-05-08</div><div class="title">JavaScript的数据类型和隐式转换</div></div></a></div><div><a href="/2023/07/14/JavaScript%E6%95%B0%E7%BB%84%E5%B8%B8%E7%94%A8%E6%96%B9%E6%B3%95/" title="JavaScript数组常用方法"><div class="cover" style="background: url(/images/cover/cover1.jpg)"></div><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2023-07-14</div><div class="title">JavaScript数组常用方法</div></div></a></div><div><a href="/2023/08/04/JavaScript%E5%BC%82%E6%AD%A5%E7%BC%96%E7%A8%8B%E5%92%8CPromise/" title="JavaScript异步编程和Promise"><div class="cover" style="background: url(/images/cover/cover1.jpg)"></div><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2023-08-04</div><div class="title">JavaScript异步编程和Promise</div></div></a></div></div></div></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src="/images/avatar.gif" onerror="this.onerror=null;this.src='/images/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">Closure233</div><div class="author-info__description"></div></div><div class="card-info-data site-data is-center"><a href="/archives/"><div class="headline">Articles</div><div class="length-num">11</div></a><a href="/tags/"><div class="headline">Tags</div><div class="length-num">6</div></a><a href="/categories/"><div class="headline">Categories</div><div class="length-num">0</div></a></div><a id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/catfish233"><i class="fab fa-github"></i><span>Follow Me</span></a></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>Catalog</span><span class="toc-percentage"></span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#JavaScript%E7%9A%84%E5%8E%9F%E5%9E%8B%E5%92%8C%E5%8E%9F%E5%9E%8B%E9%93%BE"><span class="toc-number">1.</span> <span class="toc-text">JavaScript的原型和原型链</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%8E%9F%E5%9E%8B"><span class="toc-number">1.1.</span> <span class="toc-text">原型</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%8E%9F%E5%9E%8B%E9%93%BE"><span class="toc-number">1.2.</span> <span class="toc-text">原型链</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%85%B6%E4%BB%96"><span class="toc-number">1.3.</span> <span class="toc-text">其他</span></a></li></ol></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>Recent Post</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/2023/08/08/Axios/" title="Axios"><div style="background: url(/images/cover/cover1.jpg)"></div></a><div class="content"><a class="title" href="/2023/08/08/Axios/" title="Axios">Axios</a><time datetime="2023-08-08T03:30:00.000Z" title="Created 2023-08-08 11:30:00">2023-08-08</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2023/08/04/Ajax%E8%AF%B7%E6%B1%82/" title="AJAX请求"><div style="background: url(/images/cover/cover1.jpg)"></div></a><div class="content"><a class="title" href="/2023/08/04/Ajax%E8%AF%B7%E6%B1%82/" title="AJAX请求">AJAX请求</a><time datetime="2023-08-03T16:12:00.000Z" title="Created 2023-08-04 00:12:00">2023-08-04</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2023/08/04/JavaScript%E5%BC%82%E6%AD%A5%E7%BC%96%E7%A8%8B%E5%92%8CPromise/" title="JavaScript异步编程和Promise"><div style="background: url(/images/cover/cover1.jpg)"></div></a><div class="content"><a class="title" href="/2023/08/04/JavaScript%E5%BC%82%E6%AD%A5%E7%BC%96%E7%A8%8B%E5%92%8CPromise/" title="JavaScript异步编程和Promise">JavaScript异步编程和Promise</a><time datetime="2023-08-03T16:12:00.000Z" title="Created 2023-08-04 00:12:00">2023-08-04</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2023/07/14/JavaScript%E6%95%B0%E7%BB%84%E5%B8%B8%E7%94%A8%E6%96%B9%E6%B3%95/" title="JavaScript数组常用方法"><div style="background: url(/images/cover/cover1.jpg)"></div></a><div class="content"><a class="title" href="/2023/07/14/JavaScript%E6%95%B0%E7%BB%84%E5%B8%B8%E7%94%A8%E6%96%B9%E6%B3%95/" title="JavaScript数组常用方法">JavaScript数组常用方法</a><time datetime="2023-07-14T07:45:00.000Z" title="Created 2023-07-14 15:45:00">2023-07-14</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2023/06/21/%E7%AE%80%E5%8D%95%E7%9A%84CSS%E6%95%88%E6%9E%9C%E5%AE%9E%E7%8E%B0/" title="简单的CSS效果实现"><div style="background: url(/images/cover/cover1.jpg)"></div></a><div class="content"><a class="title" href="/2023/06/21/%E7%AE%80%E5%8D%95%E7%9A%84CSS%E6%95%88%E6%9E%9C%E5%AE%9E%E7%8E%B0/" title="简单的CSS效果实现">简单的CSS效果实现</a><time datetime="2023-06-21T05:30:00.000Z" title="Created 2023-06-21 13:30:00">2023-06-21</time></div></div></div></div></div></div></main><footer id="footer" style="background: url(/images/cover/cover1.jpg)"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2023 By Closure233</div><div class="framework-info"><span>Framework </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>Theme </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="Read Mode"><i class="fas fa-book-open"></i></button><button id="darkmode" type="button" title="Switch Between Light And Dark Mode"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="Toggle between single-column and double-column"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="Setting"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="Table Of Contents"><i class="fas fa-list-ul"></i></button><button id="go-up" type="button" title="Back To Top"><span class="scroll-percent"></span><i class="fas fa-arrow-up"></i></button></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox/fancybox.umd.min.js"></script><div class="js-pjax"></div><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div></body></html>